/**
* Oxide
*
* Copyright (c) 2011 Dinosaur Kick Pty Ltd, All rights reserved.
*
* This source code is made available under the "Modified BSD" licensing arrangement.
* See license.txt for details.
*/
// ----------------------------------------------------------------------------

void error(const string_type& text)
{
	m_messages.push_back
	(
		message_type
		(
			m_cursor->line,
			m_cursor->column,
			ML_ERROR,
			text
		)
	);
}

void error(const format_type& fmt)
{
	error(fmt.str());
}

// ----------------------------------------------------------------------------

void unexpected_token_error(void)
{
	error
	(
		O2_FORMAT("Unexpected %s - '%s'.")
			% token_identity_name<string_type>(m_cursor->identity)
			% m_cursor->content
	);
}

void unexpected_token_error(token_identity expected)
{
	error
	(
		O2_FORMAT("Unexpected %s - '%s', expected %s.")
			% token_identity_name<string_type>(m_cursor->identity)
			% m_cursor->content
			% token_identity_name<string_type>(expected)
	);
}

void unexpected_token_error(token_identity expected0, token_identity expected1)
{
	error
	(
		O2_FORMAT("Unexpected %s - '%s', expected %s or %s.")
			% token_identity_name<string_type>(m_cursor->identity)
			% m_cursor->content
			% token_identity_name<string_type>(expected0)
			% token_identity_name<string_type>(expected1)
	);
}

void unexpected_token_error(token_identity expected0, token_identity expected1, token_identity expected2)
{
	error
	(
		O2_FORMAT("Unexpected %s - '%s', expected %s, %s or %s.")
			% token_identity_name<string_type>(m_cursor->identity)
			% m_cursor->content
			% token_identity_name<string_type>(expected0)
			% token_identity_name<string_type>(expected1)
			% token_identity_name<string_type>(expected2)
	);
}

// ----------------------------------------------------------------------------
